package com.tjshop.android.model;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by gytaiSSD on 2014/12/29.
 */
public class Coupons {
	private String id;
	private String sellerName;
	private String icon;
	private String desc;
	private String scope;
	private String price;
	private String vipPrice;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getSellerName() {
		return sellerName;
	}

	public void setSellerName(String sellerName) {
		this.sellerName = sellerName;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	public String getVipPrice() {
		return vipPrice;
	}

	public void setVipPrice(String vipPrice) {
		this.vipPrice = vipPrice;
	}

	public void parse(JSONObject c) {

		setId(getString(c, "id"));
		setDesc(getString(c, "desc"));
		setScope(getString(c, "scope"));
		setPrice(getString(c, "price"));
		setVipPrice(getString(c, "vip_price"));
		setIcon(getString(c, "icon"));
		setSellerName(getString(c, "seller_name"));

	}

	public String getString(JSONObject obj, String id) {
		try {
			if (obj.has(id)) {
				return obj.getString(id);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return null;
	}

}
